package com.ruibang.glass.produce.controller.cx;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.ruibang.glass.produce.domain.req.DcsRealTimeDataReq;
import com.ruibang.glass.produce.domain.resp.dcs.cx.*;
import com.ruibang.glass.produce.service.DcsCxRealTimeDataService;
import com.teaming.cloud.framework2.common.model.ResultBody;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpServletResponse;
import javax.validation.Valid;

/**
 * @Author: songJinKang
 * @CreateTime: 2024-04-23  14:53
 * @Description: TODO:DCS-窑炉实时数据控制器
 * @Version: 1.0
 */

@Api(tags = "DCS-成型实时数据控制器")
@RestController
@RequestMapping("/api/glass/produce/dcs/cx")
public class DcsCxRealTimeDataController {

    @Autowired
    private DcsCxRealTimeDataService dcsCxRealTimeDataService;

    /**
     * 查询
     */
    @PostMapping("/queryPowerTemp")
    @ApiOperation(value = "成型区功率温度", response = ResultBody.class)
    public ResultBody<IPage<PowerTemp>> queryPowerTemp(@RequestBody DcsRealTimeDataReq dcsRealTimeDataReq) {
        return ResultBody.success(dcsCxRealTimeDataService.queryPowerTemp(dcsRealTimeDataReq));
    }

    @PostMapping("/queryMufflePowerTemp")
    @ApiOperation(value = "L管马弗炉功率温度", response = ResultBody.class)
    public ResultBody<IPage<MufflePowerTemp>> queryMufflePowerTemp(@RequestBody DcsRealTimeDataReq dcsRealTimeDataReq) {
        return ResultBody.success(dcsCxRealTimeDataService.queryMufflePowerTemp(dcsRealTimeDataReq));
    }

    @PostMapping("/queryZoneOnePowerTemp")
    @ApiOperation(value = "一区功率温度", response = ResultBody.class)
    public ResultBody<IPage<ZoneOnePowerTemp>> queryZoneOnePowerTemp(@RequestBody DcsRealTimeDataReq dcsRealTimeDataReq) {
        return ResultBody.success(dcsCxRealTimeDataService.queryZoneOnePowerTemp(dcsRealTimeDataReq));
    }

    @PostMapping("/queryZoneTwoToFivePower")
    @ApiOperation(value = "2-5区功率", response = ResultBody.class)
    public ResultBody<IPage<ZoneTwoToFivePower>> queryZoneTwoToFivePower(@RequestBody DcsRealTimeDataReq dcsRealTimeDataReq) {
        return ResultBody.success(dcsCxRealTimeDataService.queryZoneTwoToFivePower(dcsRealTimeDataReq));
    }

    @PostMapping("/queryZoneTwoToThreeTemp")
    @ApiOperation(value = "2-3区温度", response = ResultBody.class)
    public ResultBody<IPage<ZoneTwoToThreeTemp>> queryZoneTwoToThreeTemp(@RequestBody DcsRealTimeDataReq dcsRealTimeDataReq) {
        return ResultBody.success(dcsCxRealTimeDataService.queryZoneTwoToThreeTemp(dcsRealTimeDataReq));
    }

    @PostMapping("/queryZoneFourToFiveTemp")
    @ApiOperation(value = "4-5区温度", response = ResultBody.class)
    public ResultBody<IPage<ZoneFourToFiveTemp>> queryZoneFourToFiveTemp(@RequestBody DcsRealTimeDataReq dcsRealTimeDataReq) {
        return ResultBody.success(dcsCxRealTimeDataService.queryZoneFourToFiveTemp(dcsRealTimeDataReq));
    }

    @PostMapping("/queryWaterTempFlow")
    @ApiOperation(value = "冷却水温度流量", response = ResultBody.class)
    public ResultBody<IPage<WaterTempFlow>> queryWaterTempFlow(@RequestBody DcsRealTimeDataReq dcsRealTimeDataReq) {
        return ResultBody.success(dcsCxRealTimeDataService.queryWaterTempFlow(dcsRealTimeDataReq));
    }

    @PostMapping("/queryStressPower")
    @ApiOperation(value = "应力区功率", response = ResultBody.class)
    public ResultBody<IPage<StressPower>> queryStressPower(@RequestBody DcsRealTimeDataReq dcsRealTimeDataReq) {
        return ResultBody.success(dcsCxRealTimeDataService.queryStressPower(dcsRealTimeDataReq));
    }


    /**
     * 趋势图
     */
    @PostMapping("/mufflePowerTempTrendChart")
    @ApiOperation(value = "L管马弗炉功率温度趋势图", response = ResultBody.class)
    public ResultBody<MufflePowerTempTrendChart> mufflePowerTempTrendChart(@RequestBody DcsRealTimeDataReq dcsRealTimeDataReq) {
        return ResultBody.success(dcsCxRealTimeDataService.mufflePowerTempTrendChart(dcsRealTimeDataReq));
    }

    /**
     * 导出
     */
    @PostMapping("/exportPowerTemp")
    @ApiOperation(value = "导出成型区功率温度", response = ResultBody.class)
    public void exportPowerTemp(@RequestBody @Valid DcsRealTimeDataReq dcsRealTimeDataReq, HttpServletResponse response) {
        dcsCxRealTimeDataService.exportPowerTemp(dcsRealTimeDataReq, response);
    }

    @PostMapping("/exportMufflePowerTemp")
    @ApiOperation(value = "导出L管马弗炉功率温度", response = ResultBody.class)
    public void exportMufflePowerTemp(@RequestBody @Valid DcsRealTimeDataReq dcsRealTimeDataReq, HttpServletResponse response) {
        dcsCxRealTimeDataService.exportMufflePowerTemp(dcsRealTimeDataReq, response);
    }

    @PostMapping("/exportZoneOnePowerTemp")
    @ApiOperation(value = "导出一区功率温度", response = ResultBody.class)
    public void exportZoneOnePowerTemp(@RequestBody @Valid DcsRealTimeDataReq dcsRealTimeDataReq, HttpServletResponse response) {
        dcsCxRealTimeDataService.exportZoneOnePowerTemp(dcsRealTimeDataReq, response);
    }

    @PostMapping("/exportZoneTwoToFivePower")
    @ApiOperation(value = "导出2-5区功率", response = ResultBody.class)
    public void exportZoneTwoToFivePower(@RequestBody @Valid DcsRealTimeDataReq dcsRealTimeDataReq, HttpServletResponse response) {
        dcsCxRealTimeDataService.exportZoneTwoToFivePower(dcsRealTimeDataReq, response);
    }

    @PostMapping("/exportZoneTwoToThreeTemp")
    @ApiOperation(value = "导出2-3区温度", response = ResultBody.class)
    public void exportZoneTwoToThreeTemp(@RequestBody @Valid DcsRealTimeDataReq dcsRealTimeDataReq, HttpServletResponse response) {
        dcsCxRealTimeDataService.exportZoneTwoToThreeTemp(dcsRealTimeDataReq, response);
    }

    @PostMapping("/exportZoneFourToFiveTemp")
    @ApiOperation(value = "导出4-5区温度", response = ResultBody.class)
    public void exportZoneFourToFiveTemp(@RequestBody @Valid DcsRealTimeDataReq dcsRealTimeDataReq, HttpServletResponse response) {
        dcsCxRealTimeDataService.exportZoneFourToFiveTemp(dcsRealTimeDataReq, response);
    }

    @PostMapping("/exportWaterTempFlow")
    @ApiOperation(value = "导出冷却水温度流量", response = ResultBody.class)
    public void exportWaterTempFlow(@RequestBody @Valid DcsRealTimeDataReq dcsRealTimeDataReq, HttpServletResponse response) {
        dcsCxRealTimeDataService.exportWaterTempFlow(dcsRealTimeDataReq, response);
    }

    @PostMapping("/exportStressPower")
    @ApiOperation(value = "导出应力区功率", response = ResultBody.class)
    public void exportStressPower(@RequestBody @Valid DcsRealTimeDataReq dcsRealTimeDataReq, HttpServletResponse response) {
        dcsCxRealTimeDataService.exportStressPower(dcsRealTimeDataReq, response);
    }
}
